// component/sanjiCitySelect/sanjiCitySelect.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    cityData: {
      type: Array,
      // value: ''
      observer: function(newValue,old) {
        this.setData({ cityList: newValue})
        this._setData(newValue)
      }
    },
    showCity: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    cityList: [],
    areaStatus: 1,
    checkProvince: 0,
    checkCity: 0,
    checkRegion: 0,
    province: [],
    area: {
      province: [],
      city: [],
      region: []
    },
    // value: [9999, 1, 1],
  },
  ready: function() {
  },
  attached: function() {
  },
  /**
   * 组件的方法列表
   */
  methods: {
    bindChange(e) {
      this.setData({ checkProvince: e.detail.value[0], checkCity: e.detail.value[1], checkRegion: e.detail.value[2]})
      this._setData(this.data.cityList)
    },
    _setData(data) {
      this.setData({ 'area.province': data, 'area.city': data[this.data.checkProvince].city, 'area.region': data[this.data.checkProvince].city[this.data.checkCity].city })
    }
  }
})
